// -----------------------------
// Author: 		Dhaenens Gert 
// Creation: 	2/12/2015 10:53:12 PM				
// -----------------------------

#ifndef _Enums_h
#define _Enums_h

#include "Assert.h"
#include "Defines.h"

namespace Flow
{

	struct Platform
	{
		enum Enum
		{
			Win32,
			Win64,
			WindowsPhone8,
		};

		static std::string ToString(Platform::Enum value)
		{
			switch (value)
			{
			case Platform::Win32:
				return "Win32";
			case Platform::Win64:
				return "Win64";
			case Platform::WindowsPhone8:
				return "Windows Phone 8";
			default:
				ASSERT(false);
			}
			return "";
		}
	};

	struct ProcessOption
	{
		enum Enum
		{
			ProcessOne,
			ProcessOneAndAll,
			ProcessAll,
		};
	};

	struct StateCommandType
	{
		enum Enum
		{
			Push,
			Swap,
			Pop,
			PopRemove,
			PopRemoveDestroy,
		};
	};

	struct StateDrawOption
	{
		enum Enum
		{
			AllowDrawBelow,
			BlockDrawBelow,
		};
	};

	struct StateUpdateOption
	{
		enum Enum
		{
			AllowUpdateBelow,
			BlockUpdateBelow,
		};
	};

	struct TextureFormat
	{
		enum Enum
		{
			Unknown,
			R8B8G8A8,
			R32B32G32A32,
		};

		static UInt32 GetSize(TextureFormat::Enum format)
		{
			switch (format)
			{
			case TextureFormat::R8B8G8A8:
				return 4;
			case TextureFormat::R32B32G32A32:
				return 16;
			default:
				ASSERT(false);
			}

			return 0;
		}
		static TextureFormat::Enum FromBPP(UInt32 bpp)
		{
			switch (bpp)
			{
			case 32:
				return TextureFormat::R8B8G8A8;
			case 128:
				return TextureFormat::R32B32G32A32;
			default:
				ASSERT(false);
			}

			return TextureFormat::Unknown;
		}
		static std::string ToString(TextureFormat::Enum format)
		{
			switch (format)
			{
			case Flow::TextureFormat::Unknown:
				return "Unknown";
			case Flow::TextureFormat::R8B8G8A8:
				return "R8G8B8A8";
			case Flow::TextureFormat::R32B32G32A32:
				return "R32B32G32A32";
			default:
				ASSERT(false);
			}
			return "";
		}
	};

	struct BufferType
	{
		enum Enum
		{
			Unknown,
			Vertex,
			Index,
			Constant,
		};

		static std::string ToString(BufferType::Enum type)
		{
			switch (type)
			{
			case BufferType::Unknown:
				return "Unknown";
			case BufferType::Vertex:
				return "Vertex";
			case BufferType::Index:
				return "Index";
			case BufferType::Constant:
				return "Constant";
			default:
				ASSERT(false);
			}
			return "";
		}
	};

	struct ShaderType
	{
		enum Enum
		{
			Vertex,
			Pixel,
		};
	};

	struct SpriteEffect
	{
		enum Enum
		{
			None = 0,
			FlipHorizontal = 1 << 1,
			FlipVertical = 1 << 2,
			Negative = 1 << 3,
		};

		static Bool HasFlag(SpriteEffect::Enum value, SpriteEffect::Enum flag)
		{
			return ((value & flag) > 0);
		}
	};

	struct InputLayoutElement
	{
		enum Enum
		{
			Unknown = 0,
			Position = 1 << 1,
			Color = 1 << 2,
			Texture = 1 << 3,
		};

		static Bool HasFlag(InputLayoutElement::Enum value, InputLayoutElement::Enum flag)
		{
			return ((value & flag) > 0);
		}
	};

}

#endif